﻿using NHibernate.Mappings;
using System;

namespace Apollo.Modules.Salary
{
    [NHibernateEntity(Table = "TransactionDefinitions")]
    public class TransactionDefinition : IHistory<TransactionDefinition>, ITrackable
    {
        public TransactionDefinition() { }

        [PrimaryKey]
        public virtual int Id { get; set; }

        [Property]
        public virtual string Name { get; set; }

        [Property]
        public virtual string Code { get; set; }

        [Property]
        public virtual double MinValue { get; set; }

        [Property]
        public virtual double MaxValue { get; set; }

        [Property]
        public virtual TransactionFlow Flow { get; set; }

        [Property]
        public virtual TransactionType Type { get; set; }
        
        [BelongsTo(Column = "ID_Tax")]
        public virtual Tax Tax { get; set; }




        [BelongsTo(Column = "ID_BelonsTo_TransactionDefinition")]
        public virtual TransactionDefinition BelongsTo { get; set; }

        [Property]
        public virtual DateTime EffectiveDate { get; set; }

        [Property]
        public virtual DateTime LearnDate { get; set; }
        
        [Property]
        public virtual State State { get; set; }



        [Property]
        public virtual DateTime InsertDate { get; set; }

        [Property]
        public virtual string InsertBy { get; set; }

        [Property]
        public virtual DateTime? ModifiedDate { get; set; }

        [Property]
        public virtual string ModifiedBy { get; set; }
    }
   
    public enum TransactionFlow { 
        Debit = 0, Credit = 1 
    }

    public enum TransactionType { 
        Income = 0,
        Tax = 1,
        Advance = 2,
        Garnishment = 3, // poprire
        Fund = 4,
    }
}
